package com.yanqu.road.entity.cricket;

import com.yanqu.road.entity.DataObject;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 蛐蛐数据
 */
public class CricketData extends DataObject {

    /**
     * 用户id
     */
    private long userId;

    /**
     * 蛐蛐id
     */
    private int cricketId;

    /**
     * 蛐蛐品质
     */
    private int quality;

    /**
     * 军衔
     */
    private int title;

    /**
     * 品阶
     */
    private int littleTitle;

    /**
     * 基础资质
     */
    private CricketTalent cricketTalent = new CricketTalent();

    /**
     * 属性
     */
    private CricketProperty cricketProperty = new CricketProperty();

    /**
     * 加成属性(技能buff)
     */
    private CricketProperty addProperty = new CricketProperty();

    /**
     * 技能分三个字段处理
     * 技能-攻击方式
     */
    private List<CricketSkill> attackSkillList = new ArrayList<>();

    /**
     * 技能分三个字段处理
     * 技能-天生被动
     */
    private List<CricketSkill> initSkillList = new ArrayList<>();

    /**
     * 技能分三个字段处理
     * 技能-天赋
     */
    private List<CricketSkill> skillList = new ArrayList<>();

    //普通技能，和门客鱼这些通用的
    private List<CricketEquipSkill> equipSkillList = new ArrayList<>();

    /**
     * 匹配次数
     */

    private int matchTimes;

    /**
     * 最后一次匹配时间
     */

    private long lastMatchTime;
    /**
     * 出战次数
     */
    private int battleTimes;

    private int battleWinTimes;
    /**
     * 当前赛季（废弃）
     */
    private int currentSeasonId;

    /**
     * 当前赛季战斗次数(废弃)
     */

    private int currentSeasonBattleTimes;

    private int currentSeasonBattleWinTimes;

    private int equipTimes;

    private int equipBuyTimes;

    private int equipPatronsId;

    //获得的蛐蛐数量加缘分值的还没有加的个数
    private int rewardNum;



    /**
     * 数据变动，不入库
     */
    private CricketDataChange change = new CricketDataChange();

    public CricketData clone() {
        CricketData cricketData = new CricketData();
        cricketData.setUserId(this.userId);
        cricketData.setCricketId(this.cricketId);
        cricketData.setQuality(this.quality);
        cricketData.setTitle(this.title);
        cricketData.setLittleTitle(this.littleTitle);
        cricketData.setCricketTalent(this.cricketTalent.clone());
        cricketData.setCricketProperty(this.cricketProperty.clone());
        cricketData.setAddProperty(this.addProperty.clone());
        // 攻击方式
        List<CricketSkill> attackSkillListClone = new ArrayList<>();
        for (CricketSkill cricketSkill : attackSkillList) {
            attackSkillListClone.add(cricketSkill.clone());
        }
        cricketData.setAttackSkillList(attackSkillListClone);
        // 天生天赋
        List<CricketSkill> initSkillListClone = new ArrayList<>();
        for (CricketSkill cricketSkill : initSkillList) {
            initSkillListClone.add(cricketSkill.clone());
        }
        cricketData.setInitSkillList(initSkillListClone);
        // 被动技能
        List<CricketSkill> skillListClone = new ArrayList<>();
        for (CricketSkill cricketSkill : skillList) {
            skillListClone.add(cricketSkill.clone());
        }
        cricketData.setSkillList(skillListClone);
        cricketData.setBattleTimes(this.battleTimes);
        cricketData.setChange(this.change.clone());
        return cricketData;
    }


    public CricketData() {

    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public int getCricketId() {
        return cricketId;
    }

    public void setCricketId(int cricketId) {
        if (this.cricketId != cricketId) {
            this.cricketId = cricketId;
            setUpdateOption();
        }
    }

    public int getQuality() {
        return quality;
    }

    public void setQuality(int quality) {
        if (this.quality != quality) {
            this.quality = quality;
            setUpdateOption();
        }
    }

    public int getTitle() {
        return title;
    }

    public void setTitle(int title) {
        if (this.title != title) {
            this.title = title;
            setUpdateOption();
        }
    }

    public int getLittleTitle() {
        return littleTitle;
    }

    public void setLittleTitle(int littleTitle) {
        if (this.littleTitle != littleTitle) {
            this.littleTitle = littleTitle;
            setUpdateOption();
        }
    }

    public CricketTalent getCricketTalent() {
        return cricketTalent;
    }

    public void setCricketTalent(CricketTalent cricketTalent) {
        this.cricketTalent = cricketTalent;
        setUpdateOption();
    }

    public CricketProperty getCricketProperty() {
        return cricketProperty;
    }

    public void setCricketProperty(CricketProperty cricketProperty) {
        this.cricketProperty = cricketProperty;
        setUpdateOption();
    }

    public CricketProperty getAddProperty() {
        return addProperty;
    }

    public void setAddProperty(CricketProperty addProperty) {
        this.addProperty = addProperty;
        setUpdateOption();
    }

    public List<CricketSkill> getAttackSkillList() {
        return attackSkillList;
    }

    public void setAttackSkillList(List<CricketSkill> attackSkillList) {
        this.attackSkillList = attackSkillList;
        setUpdateOption();
    }

    public List<CricketSkill> getInitSkillList() {
        return initSkillList;
    }

    public void setInitSkillList(List<CricketSkill> initSkillList) {
        this.initSkillList = initSkillList;
        setUpdateOption();
    }

    public List<CricketSkill> getSkillList() {
        return skillList;
    }

    public void setSkillList(List<CricketSkill> skillList) {
        this.skillList = skillList;
        setUpdateOption();
    }

    public int getBattleTimes() {
        return battleTimes;
    }

    public void setBattleTimes(int battleTimes) {
        if (this.battleTimes != battleTimes) {
            this.battleTimes = battleTimes;
            setUpdateOption();
        }
    }

    public CricketDataChange getChange() {
        return change;
    }

    public void setChange(CricketDataChange change) {
        this.change = change;
    }



    public int getCurrentSeasonId() {
        return currentSeasonId;
    }

    public void setCurrentSeasonId(int currentSeasonId) {
        this.currentSeasonId = currentSeasonId;
        this.setUpdateOption();
    }

    public int getCurrentSeasonBattleTimes() {
        return currentSeasonBattleTimes;
    }

    public void setCurrentSeasonBattleTimes(int currentSeasonBattleTimes) {
        this.currentSeasonBattleTimes = currentSeasonBattleTimes;
        this.setUpdateOption();
    }

    public int getBattleWinTimes() {
        return battleWinTimes;
    }

    public void setBattleWinTimes(int battleWinTimes) {
        this.battleWinTimes = battleWinTimes;
        this.setUpdateOption();
    }

    public int getCurrentSeasonBattleWinTimes() {
        return currentSeasonBattleWinTimes;
    }

    public void setCurrentSeasonBattleWinTimes(int currentSeasonBattleWinTimes) {
        this.currentSeasonBattleWinTimes = currentSeasonBattleWinTimes;
        this.setUpdateOption();
    }

    public int getMatchTimes() {
        return matchTimes;
    }

    public void setMatchTimes(int matchTimes) {
        if (this.matchTimes != matchTimes) {
            this.matchTimes = matchTimes;
            this.setUpdateOption();
        }
    }

    public long getLastMatchTime() {
        return lastMatchTime;
    }

    public void setLastMatchTime(long lastMatchTime) {
        this.lastMatchTime = lastMatchTime;
        this.setUpdateOption();
    }


    /**
     * 获取蛐蛐所有技能
     */
    public List<CricketSkill> getAllCricketSkillList() {
        List<CricketSkill> list = new ArrayList<>();
        list.addAll(attackSkillList);
        list.addAll(initSkillList);
        list.addAll(skillList);
        return list;
    }

    public List<CricketSkill> getAllCricketSkillListExcludeInit() {
        List<CricketSkill> list = new ArrayList<>();
        list.addAll(attackSkillList);
        list.addAll(skillList);
        return list;
    }

    public int getEquipTimes() {
        return equipTimes;
    }

    public void setEquipTimes(int equipTimes) {
        if(equipTimes != this.equipTimes){
            this.equipTimes = equipTimes;
            setUpdateOption();
        }
    }

    public int getEquipBuyTimes() {
        return equipBuyTimes;
    }

    public void setEquipBuyTimes(int equipBuyTimes) {
        if(equipBuyTimes != this.equipBuyTimes){
            this.equipBuyTimes = equipBuyTimes;
            setUpdateOption();
        }
    }

    public int getEquipPatronsId() {
        return equipPatronsId;
    }

    public void setEquipPatronsId(int equipPatronsId) {
        if(equipPatronsId != this.equipPatronsId){
            this.equipPatronsId = equipPatronsId;
            setUpdateOption();
        }
    }

    public CricketEquipSkill getEquipSkill(int skillId) {
        for(CricketEquipSkill skill : equipSkillList){
            if(skill.getSkillId() == skillId){
                return skill;
            }
        }
        return null;
    }

    public List<CricketEquipSkill> getEquipSkillList() {
        return equipSkillList;
    }

    public void setEquipSkillList(List<CricketEquipSkill> equipSkillList) {
        this.equipSkillList = equipSkillList;
    }


    public int getRewardNum() {
        return rewardNum;
    }

    public void setRewardNum(int rewardNum) {
        if(rewardNum != this.rewardNum){
            this.rewardNum = rewardNum;
            setUpdateOption();
        }
    }
}
